<template>
  <div>
    <header class="header">
      <comp-header>
        <template v-slot:ctitle>理财</template>
        <template v-slot:cicon
          ><span class="fa fa-align-justify"></span
        ></template>
      </comp-header>
      <div class="all-money">
        <div class="left">
          <!-- fa-eye-slash -->
          <div>
            <h4>总财富<span class="fa fa-eye" @click="isshow=false" v-if="isshow"></span>
            <span class="fa fa-eye-slash" @click="isshow=true" v-if="!isshow"></span></h4>
          </div>
          <div class="jine" v-if="isshow"><h2>9999.00</h2></div>
          <div class="jine" v-if="!isshow"><h2>*****</h2></div>
        </div>
        <div class="right">
          <div><h4>昨日收益</h4></div>
          <div class="jine" v-if="isshow"><h2>6.00</h2></div>
          <div class="jine" v-if="!isshow"><h2>****</h2></div>
        </div>
      </div>
    </header>
    <div class="content-box">
      <div class="licai-shouyi">
        <div>今日收益待更新</div>
        <div>查看详情<span class="fa fa-caret-right"></span></div>
      </div>
    </div>
    <div class="types">
      <ul>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">定期+</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">活期+</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">贵金属</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">基金</span>
          </a>
        </li>
        <li>
          <a href="javascript:;">
            <span class="icon"></span>
            <span class="text">借钱</span>
          </a>
        </li>
      </ul>
    </div>
    <comp-banner>
      <template v-slot:fimg>
        <img src="../assets/teach.png" alt="" />
      </template>
      <template v-slot:simg>
        <img src="../assets/test.png" alt="" />
      </template>
      <template v-slot:timg>
        <img src="../assets/travail.png" alt="" />
      </template>
    </comp-banner>
    <comp-title-second>
      <template v-slot:title>活期T+0</template>
      <template v-slot:mome
        >查看更多<span class="fa fa-caret-right"></span
      ></template>
    </comp-title-second>
    <div class="huoqi">
      <div><h4>捡钱宝基金</h4></div>
      <div><h1>+12.66%</h1></div>
      <div><h5>年化利率 存款期限6个月</h5></div>
      <div><button>开始赚钱</button></div>
    </div>
    <comp-title-second>
      <template v-slot:title>热销产品</template>
      <template v-slot:mome
        >查看更多<span class="fa fa-caret-right"></span
      ></template>
    </comp-title-second>
    <div class="rxcp">
      <ul class="rxcp-list">
        <li v-for="item in arrrxcp" :key="item.id">
          <div>
            <div class="top">
              <h3>
                {{ item.name }} <span>{{ item.pro }}</span>
              </h3>
            </div>
            <div class="bottom">
              <div class="left">
                <div>
                  <h1>{{ item.shouyi }}</h1>
                </div>
                <div>
                  <h5>{{ item.shouyi }}</h5>
                </div>
              </div>
              <div class="right">
                <ul>
                  <li><span class="fa fa-circle"></span>{{ item.good[0] }}</li>
                  <li><span class="fa fa-circle"></span>{{ item.good[1] }}</li>
                  <li><span class="fa fa-circle"></span>{{ item.good[2] }}</li>
                </ul>
              </div>
            </div>
          </div>
        </li>
      </ul>
    </div>
    <comp-nomore></comp-nomore>
  </div>
</template>

<script>
import compHeader from "@/components/comp-header.vue";
import compBanner from "@/components/comp-banner.vue";
import compTitleSecond from "@/components/comp-title-second.vue";
import compNomore from "@/components/comp-nomore.vue";
export default {
  name: "LiCai",
  components: {
    compHeader: compHeader,
    compBanner: compBanner,
    compTitleSecond: compTitleSecond,
    compNomore: compNomore,
  },
  data() {
    return {
      arrrxcp: [],
      scrollTop2: 0,
      isshow:true
    };
  },
  methods: {
    getData() {
      let pro = axios.get("/rxcp.jsonp");
      pro.then((response) => {
        if (response.data.code == 200) {
          let res = response.data.result;
          let arr = [];
          res.forEach((item) => {
            let obj = {};
            obj.id = item.id;
            obj.name = item.name;
            obj.pro = item.pro;
            obj.shouyi = item.shouyi;
            obj.timer = item.timer;
            obj.good = item.good;
            arr.push(obj);
          });
          this.arrrxcp = arr;
        }
      });
    }
  },
  mounted() {
    this.getData();
  },
  beforeRouteLeave(to, from, next) {
    this.scrollTop2 = document.documentElement.scrollTop || document.body.scrollTop;
    next();
  },
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      window.scrollTo(0,vm.scrollTop2);
    });
  },
};
</script>

<style lang="scss" scoped>
.header {
  width: 100%;
  height: 140px;
  background: url(../assets/online1.png) no-repeat;
  background-size: (960px * (4/10)) (591px * (4/10));
  .all-money {
    width: 100%;
    height: 90px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    position: absolute;
    top: 50px;
    .jine {
      margin-top: 10px;
    }
    h4 {
      font-size: 12px;
      opacity: 0.7;
      color: #fff;
      font-weight: normal;
      span {
        margin-left: 10px;
        font-size: 14px;
      }
    }
    h2 {
      font-size: 20px;
      color: #fff;
    }
  }
}
.content-box {
  width: 100%;
  .licai-shouyi {
    width: 100%;
    height: 35px;
    background-color: #7f7bfd;
    color: #fff;
    padding: 0 20px;
    box-sizing: border-box;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    line-height: 35px;
    span {
      margin-left: 5px;
    }
  }
}
.types {
  width: 355px;
  height: 80px;
  box-sizing: border-box;
  margin: 0 auto;
  ul {
    width: 100%;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    li {
      margin-top: 15px;
      flex-basis: 20%;
      flex-flow: 1;
      flex-shrink: 0;
      text-align: center;
      a {
        .icon {
          display: block;
          margin-left: 20px;
          width: 50px * (5/10);
          height: 50px * (5/10);
          background: url(../assets/sprite1.png) no-repeat;
          background-size: (623px * (5/10)) (1016px * (5/10));
        }
        .text {
          display: block;
          margin-top: 5px;
          font-size: 12px;
        }
      }
    }
    li:nth-child(1) .icon {
      background-position: (-355px * (5/10)) (-605px * (5/10));
    }
    li:nth-child(2) .icon {
      background-position: (-490px * (5/10)) (-605px * (5/10));
    }
    li:nth-child(3) .icon {
      margin-left: 22px;
      background-position: (-82px * (5/10)) (-745px * (5/10));
    }
    li:nth-child(4) .icon {
      background-position: (-215px * (5/10)) (-745px * (5/10));
    }
    li:nth-child(5) .icon {
      background-position: (-350px * (5/10)) (-745px * (5/10));
    }
  }
}
.huoqi {
  width: 355px;
  height: 140px;
  box-shadow: 0 0 5px #ccc;
  border-radius: 5px;
  margin: 0 auto;
  text-align: center;
  h4 {
    font-size: 15px;
    font-weight: normal;
    padding-top: 10px;
  }
  h1 {
    font-size: 27px;
    color: #ff1717;
  }
  h5 {
    font-size: 12px;
    color: #999;
    font-weight: normal;
  }
  button {
    width: 80px;
    height: 30px;
    background-color: #4f3cb1;
    border-radius: 15px;
    font-size: 12px;
    color: #fff;
  }
}
.rxcp {
  width: 355px;
  margin: 0 auto;
  .rxcp-list {
    width: 355px;
    > li {
      width: 355px;
      height: 120px;
      box-shadow: 0 0 5px #ccc;
      border-radius: 5px;
      margin-bottom: 15px;
      padding: 0 12px;
      box-sizing: border-box;
      .top {
        width: 100%;
        height: 39px;
        border-bottom: 1px solid #ccc;
        font-size: 15px;
        line-height: 39px;
        h3 {
          font-weight: normal;
        }
        span {
          font-size: 12px;
          padding: 1px 3px;
          border-radius: 3px;
          color: #7f7bfd;
          border: 1px solid #7f7bfd;
        }
      }
      .bottom {
        width: 100%;
        height: 80px;
        display: flex;
        align-items: center;
        .left {
          width: 120px;
          height: 50px;
          border-right: 1px solid #a3a3a3;
          text-align: center;
          padding-right: 20px;
          padding-left: 20px;
          h1 {
            font-size: 23px;
            color: #ff4545;
          }
          h5 {
            font-size: 12px;
            color: #a3a3a3;
            font-weight: normal;
          }
        }
        .right {
          ul {
            margin-left: 20px;
            li {
              font-size: 12px;
              span {
                margin-right: 10px;
                color: #513eb2;
              }
            }
          }
        }
      }
    }
  }
}
</style>